package cn.dglydrpy.study.ssm.common.kafka.deserializer;

import net.sf.json.JSONObject;
import org.apache.kafka.common.serialization.Deserializer;

import java.util.Map;

public class JSONDeserializer implements Deserializer<JSONObject> {
    @Override
    public void configure(Map<String, ?> map, boolean b) {

    }

    @Override
    public JSONObject deserialize(String s, byte[] bytes) {
        JSONObject result = null;
        try {
            result = JSONObject.fromObject(new String(bytes,"UTF-8"));
            return result;
        } catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public void close() {

    }
}
